package pers.cj.pdos.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.cj.pdos.entity.PayWait;
import pers.cj.pdos.mapper.PayWaitMapper;
import pers.cj.pdos.service.IPayWaitService;
import pers.cj.pdos.utils.Utils;
import pers.cj.pdos.vo.PayWaitVo;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenj
 * @since 2020-01-19
 */
@Service
public class PayWaitServiceImpl extends ServiceImpl<PayWaitMapper, PayWait> implements IPayWaitService {
    @Autowired
    PayWaitMapper payWaitMapper;
    @Override
    public List<Map> listVo(String companyId,
                            Integer page,
                            Integer limit,
                            String storeId,
                            String providerTypeId,
                            Boolean notNeedPay,
                            Boolean providerNoStop,
                            String search) {
        return payWaitMapper.listVo(companyId,
                Utils.genPage(page,limit),
                limit,
                storeId,
                providerTypeId,
                notNeedPay,
                providerNoStop,
                search);
    }

    @Override
    public Long count(String companyId,
                      String storeId,
                      String providerTypeId,
                      Boolean notNeedPay,
                      Boolean providerNoStop,
                      String search) {
        return payWaitMapper.count(companyId,
                storeId,
                providerTypeId,
                notNeedPay,
                providerNoStop,
                search);
    }

    @Override
    public PayWaitVo getVoByProvider(String providerId) {
        return payWaitMapper.getVoByProvider(providerId);
    }

    @Override
    public List<Map> listDetail(String providerId,
                                Integer page,
                                Integer limit,
                                Boolean close,
                                String search,
                                String no,
                                String remark,
                                String userId,
                                Date date1,
                                Date date2,
                                Integer flag,
                                String storeId) {
        return payWaitMapper.listDetail(providerId, Utils.genPage(page,limit), limit, close, search, no, remark, userId, date1, date2, flag, storeId);
    }

    @Override
    public long countDetail(String providerId,
                            Boolean close,
                            String search,
                            String no,
                            String remark,
                            String userId,
                            Date date1,
                            Date date2,
                            Integer flag,
                            String storeId) {
        return payWaitMapper.countDetail(providerId,close, search, no, remark, userId, date1, date2, flag, storeId);
    }

    @Override
    public BigDecimal getTotalAmount(String companyId) {
        return payWaitMapper.getTotalAmount(companyId);
    }
}
